package com.dldata.devtools30.repository.sysform;


import com.dldata.devtools30.entity.DevtFormListtemplateEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**

 */
@Repository
public interface DevtFormListtemplateEntityDao extends com.dldata.devtools30.repository.BaseRepository<DevtFormListtemplateEntity,String>, JpaSpecificationExecutor<DevtFormListtemplateEntity> {
        
        @Query("select f from DevtFormListtemplateEntity f where f.formId=?1 order by f.xh")
        public List<DevtFormListtemplateEntity> getFormListtemplateByFormId(String formId);
        
        @Query("select f from DevtFormListtemplateEntity f  order by f.xh")
        public List<DevtFormListtemplateEntity> getDataAll();
        
        @Query("select f from DevtFormListtemplateEntity f where f.flid like ?1 order by f.xh")
        public List<DevtFormListtemplateEntity> getDataByFl(String flid);
        
        @Query("select f from DevtFormListtemplateEntity f where  f.name like ?1 order by f.xh")
        public List<DevtFormListtemplateEntity> getDataByName(String search);
        
        @Query("select f from DevtFormListtemplateEntity f where f.flid like ?1 and f.name like ?2 order by f.xh")
        public List<DevtFormListtemplateEntity> getDataByFl(String flid, String search);
        
        @Query("select a from DevtFormListtemplateEntity a where a.formId=?1 and a.active= 1 order by  a.xh")
        public DevtFormListtemplateEntity getFormActivtyTemplateByFormId(String formId);
        
        
        @Query("select max(a.xh) from DevtFormListtemplateEntity a where a.flid=?1")
        public Integer getMaxXh(String Flid);
        
        
        @Query("select a from DevtFormListtemplateEntity a where a.formId=?1 and a.active= 1 order by  a.xh")
        public DevtFormListtemplateEntity getFormActivtyTemplateByFormIdAndType(String formId );

}
